﻿<WindowsAPICodePackShell:GlassWindow x:Class="ArmoryViewer.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:ui="clr-namespace:UIControls;assembly=UIControls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:l="clr-namespace:ArmoryViewer"
    xmlns:loc="clr-namespace:ArmoryViewer.Classes"
    xmlns:WindowsAPICodePackPresentation="clr-namespace:Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation;assembly=Microsoft.WindowsAPICodePack.Shell"
    xmlns:WindowsAPICodePackShell="clr-namespace:Microsoft.WindowsAPICodePack.Shell;assembly=Microsoft.WindowsAPICodePack.Shell"
    Title="Armory Search" Height="485" Width="610" AllowsTransparency="False" MinHeight="340" MinWidth="490" ResizeMode="CanResizeWithGrip" Icon="/ArmoryViewer;component/Resources/armoryViewer.ico" Loaded="MainWindow_Loaded" Closed="MainWindow_Closed"  StateChanged="MainWindow_StateChanged" Closing="MainWindow_Closing">
    <WindowsAPICodePackShell:GlassWindow.Resources>
        <DataTemplate x:Key="HeaderTemplateSortAsc">
            <DockPanel>
                <TextBlock HorizontalAlignment="Center" Text="{Binding}"/>
                <Path x:Name="arrow" StrokeThickness="1" Fill="gray" Data="M 5,10 L 15,10 L 10,5 L 5,10" />
            </DockPanel>
        </DataTemplate>
        <DataTemplate x:Key="HeaderTemplateSortDesc">
            <DockPanel>
                <TextBlock HorizontalAlignment="Center" Text="{Binding }"/>
                <Path x:Name="arrow" StrokeThickness="1" Fill="gray" Data="M 5,5 L 10,10 L 15,5 L 5,5" />
            </DockPanel>
        </DataTemplate>
        
        <LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
            <LinearGradientBrush.GradientStops>
                <GradientStopCollection>
                    <GradientStop Color="#CCC" Offset="0.0" />
                    <GradientStop Color="#CCC" Offset="1.0" />
                </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
        
        <!-- Separator -->
        <Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}">
            <Setter Property="Height" Value="1" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Separator}">
                        <Rectangle Height="{TemplateBinding Height}"
                                   Fill="{StaticResource NormalBorderBrush}" />
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </WindowsAPICodePackShell:GlassWindow.Resources>
    <Grid Background="Transparent">
    	<DockPanel Height="32" Margin="10,0,12,0" VerticalAlignment="Top">
    		<ComboBox Height="23" DockPanel.Dock="Left" x:Name="cboSearchType" VerticalAlignment="Center" Width="157" SelectedIndex="1">
    			<ComboBoxItem loc:LocalizationProvider.ContentID="ArenaTeams"/>
    			<ComboBoxItem loc:LocalizationProvider.ContentID="Characters"/>
    			<ComboBoxItem loc:LocalizationProvider.ContentID="Guilds"/>
    		</ComboBox>
            <StackPanel DockPanel.Dock="Right" Height="23" Orientation="Horizontal">
                <!--<Button Margin="0,0,5,0" Height="23" x:Name="btnSearch" Width="75" IsDefault="True" TabIndex="1" loc:LocalizationProvider.ContentID="Search" Click="btnSearch_Click" /> -->
                <Button Click="btnMenu_Click" Width="55">
                    <Button.Content>
                        <DockPanel>
                            <TextBlock HorizontalAlignment="Center" Text="Tools"/>
                            <Path StrokeThickness="1" Fill="Black" Data="M 5,5 L 10,10 L 15,5 L 5,5" />
                        </DockPanel>
                    </Button.Content>
                    <Button.ContextMenu>
                        <ContextMenu x:Name="mnuMain">
                            <MenuItem loc:LocalizationProvider.ContentID="Preferences" Click="Preferences_Click" />
                            <MenuItem Header="_Debug" x:Name="menuDebug">
                                <MenuItem Header="_Generate Error" Click="Error_Click" />
                                <MenuItem Header="Force Update" x:Name="menuForceUpdate" Click="menuForceUpdate_Click" />
                            </MenuItem>
                            <Separator  />
                            <MenuItem loc:LocalizationProvider.ContentID="CheckForUpdates" Name="menuHelpUpdates" Click="menuHelpUpdates_Click" />   
                            <MenuItem loc:LocalizationProvider.ContentID="About" Name="menuAbout" Click="menuAbout_Click" />
                            <Separator />
                            <MenuItem loc:LocalizationProvider.ContentID="Exit" Click="Exit_Click" InputGestureText="Alt+F4" />
                        </ContextMenu>
                    </Button.ContextMenu>
                </Button>

            </StackPanel>
            <ui:SearchTextBox x:Name="txtQuery" Search="txtQuery_Search" Height="23" Margin="10,0,10,0" SearchMode="Delayed" />

            <!--<TextBox Height="23" Margin="10,0,5,0" x:Name="txtQuery" VerticalAlignment="Center" TabIndex="0" loc:LocalizationProvider.ContentID="Search" GotKeyboardFocus="txtQuery_GotKeyboardFocus" LostKeyboardFocus="txtQuery_LostKeyboardFocus" FontStyle="Italic" Foreground="Gray" /> -->
        </DockPanel>
    	<ListView 
            VirtualizingStackPanel.IsVirtualizing="True" 
            Margin="12,41,12,11" 
            x:Name="lvwResults" 
            ItemsSource="{Binding string[]}"
            l:ListViewSorter.IsListviewSortable="True" MouseDoubleClick="lvwResults_MouseDoubleClick">
            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Load Character" Click="LoadCharacter_Click" />
                </ContextMenu>
            </ListView.ContextMenu>
            <ListView.View>
    			<GridView>
                    <GridViewColumn DisplayMemberBinding="{Binding Path=[Name]}" loc:LocalizationProvider.ContentID="Name" Width="50" />
                    <GridViewColumn DisplayMemberBinding="{Binding Path=[Level]}" loc:LocalizationProvider.ContentID="Level" Width="50"/>
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Race]}" loc:LocalizationProvider.ContentID="Race" Width="50" />
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Class]}" loc:LocalizationProvider.ContentID="Class" Width="50" />
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Faction]}" loc:LocalizationProvider.ContentID="Faction" Width="50" />
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Guild]}" loc:LocalizationProvider.ContentID="Guild" Width="50" />
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Realm]}" loc:LocalizationProvider.ContentID="Realm" Width="50" />
    				<GridViewColumn DisplayMemberBinding="{Binding Path=[Battlegroup]}" loc:LocalizationProvider.ContentID="Battlegroup" Width="80" />
    			</GridView>
    		</ListView.View>
    	</ListView>
    </Grid>
</WindowsAPICodePackShell:GlassWindow>
